package com.tre.jdevtemplateboot.exception.global;

import com.tre.jdevtemplateboot.common.enums.ExceptionHandlerEnums;

import java.io.Serializable;

public class SysBusinessException extends RuntimeException implements Serializable {

    private static final long serialVersionUID = 1L;
    private final int status ;
    private final int code;

    public SysBusinessException() {
        super(ExceptionHandlerEnums.SERVER_INTERNAL_ERROR.getMsg());
        this.status = ExceptionHandlerEnums.SERVER_INTERNAL_ERROR.getStatus();
        this.code = ExceptionHandlerEnums.SERVER_INTERNAL_ERROR.getCode();
    }

    public SysBusinessException(String message, int status, int code) {
        super(message);
        this.status = status;
        this.code = code;
    }

    public SysBusinessException(String message) {
        super(message);
        this.status = ExceptionHandlerEnums.SERVER_INTERNAL_ERROR.getStatus();
        this.code = ExceptionHandlerEnums.SERVER_INTERNAL_ERROR.getCode();
    }
    public SysBusinessException(String message, Throwable cause, int status, int code) {
        super(message, cause);
        this.status = status;
        this.code = code;
    }
    public SysBusinessException(Throwable cause, int status, int code) {
        super(cause);
        this.status = status;
        this.code = code;
    }

    public int getStatus() {
        return status;
    }

    public int getCode() {
        return code;
    }
}
